
/*
FLOWN data that are used here are created by the code provided by Statistics Finland
- loops over firms owning firms to find the person owners
*/

use "W:\Inequality\2021analysis\Data\Omistusdata\flown_20032019_divs_owners_1st_attemp.dta", clear
bysort shnro vuosi: gen nr_of_firms = _N
egen NR_of_firms=max(nr_of_firms), by(shnro vuosi)
keep syrtun shnro vuosi NR_of_firms ownrshp
tab NR_of_firms
gen ie=1
gen ie_mltpl=0
replace ie_mltpl=1 if NR_of_firms>1
ren NR_of_firms nr_of_firms
label var nr_of_firms "Number of firms a person owns in a given year"
label var ie "Incorporated entrepreneur"
label var ie_mltpl "Incorporated entrepreneur who owns more than one firm"
keep if vuosi>2005
save "$data\99_temp\flownyrtti.dta", replace
